const { Sequelize, Model } = require("sequelize");
const { db } = require("../core/db");

const classesBase = {
  type: Sequelize.STRING,
  content: Sequelize.STRING,
  fav_nums: Sequelize.INTEGER,
  title: Sequelize.STRING,
  pubdate: Sequelize.DATEONLY,
  image: Sequelize.STRING,
};

class Movie extends Model {}
Movie.init(classesBase, { sequelize: db, tableName: "movie" });

class Sentence extends Model {}
Sentence.init(classesBase, { sequelize: db, tableName: "sentence" });

const Obj = { ...classesBase, url: Sequelize.STRING };
class Music extends Model {}
Music.init(Obj, { sequelize: db, tableName: "music" });

module.exports = {
  Movie,
  Sentence,
  Music,
};
